<?php
/**
 * Created by PhpStorm.
 * UsersF: Mloong
 * Date: 2019/3/2
 * Time: 10:19
 */

namespace app\sign\controller;




use app\sign\service\showService;
use app\sign\validate\DelOneModelCheck;
use app\sign\validate\LayuiPageValidate;
use think\facade\Request;

class Show extends BaseController
{
    public function index()
    {
        return $this->fetch('/login/show');
    }
    # 获取当前标识的所有数据
    public function getSignData($page,$limit,$model)
    {
//        (new LayuiPageValidate())->goCheck();
        $service = new showService();
        $result = $service->returnSign($model,$page,$limit);
        return json($result);
    }
    # 根据时间查询对应标识的所有数据(默认显示本周)
    public function findData()
    {
        (new LayuiPageValidate())->goCheck();
        $getData = Request::get();
        $service = new showService();
        $result = $service->findTimeSign($getData['page'], $getData['limit'],$getData['model'],$getData['field']);
        return json($result);
    }
    # 删除一条记录(假删除，把状态更新为-1)
    public function delOnePopularize()
    {
        (new DelOneModelCheck())->goCheck();
        $getData = Request::get();
        $service = new showService();
        $result = $service->delOne($getData['model'],$getData['add_time']);
        if($result == 1){
            return json([
                'code' => 200
            ]);
        }else{
            return json([
                'code' => 404
            ]);
        }
    }

    public function getHasRegistered()
    {
        return $this->fetch('/login/hasRegistered');
    }

    # 获取已经成功贷款的手机号码
    public function getHasRegisteredApi($page,$limit)
    {
        $service = new showService();
        $result = $service->getSuccessMoney($page,$limit);
        return json($result);
    }
}